<?php
/*  
  Copyright (c) 2010-02 SongCMS 
  SongCMS All Rights Reserved. 
  Support:www.SongCMS.com
  QQ:544255858   19951025
  Author:Song  Version:3.17
  Date:2010-08-12 09:28:32
*/
include_once(SONGCMSROOT . 'config/userauthority.php'); 
if(in_array($TemFile,$UserFile) && $WebStaticHTML == 0){
	$WebStaticHTML = 0;
	if(@$_COOKIE['isLogin'] != 'songcms'){
		$oULR = $Lang == 1 ? "./?flogin" : "./?flogin/l{$Lang}";
		MsgBox('1',$Warning[19],$oULR);
	}
}
@include_once(SONGCMSROOT . 'plugins/ucenter/config.inc.php');
if(!defined('UC_ENABLED')) define('UC_ENABLED',0);
if (UC_ENABLED == 1){
	include_once(SONGCMSROOT.'plugins/ucenter/uc_client/client.php');
	if(!empty($_COOKIE['Example_auth']) && $_COOKIE['isLogin'] != 'songcms'){
		list($Example_uid, $Example_username) = explode("\t", uc_authcode($_COOKIE['Example_auth'], 'DECODE'));
		setcookie('isLogin','songcms');
		setcookie("User[Name]",$Example_username);	
	}
	if (empty($_COOKIE['Example_auth'])){
		setcookie('isLogin','',time()-1,'/');
		setcookie('isLogin','',time()-1);
	}
}
include_once(SONGCMSROOT . 'config/navigation.php');
$navigation = ${'navigation'.$Lang};
foreach ($navigation as $i => &$n){
	if($n['sShow'] == 1){
		$vSort[$i] = $n['sSort']; 
		$vModu[$i] = $n['sModu'];
		$n['URL'] = $isDynamicURL == 1 ? $n['sDURL'] : $n['sHURL'];
		switch ($n['sModu']){
			case 0: $n['ClassID'] = 'SC_MENU_HOME'; break;
			case 1: $n['ClassID'] = 'SC_MENU_PRODUCT'; break;
			case 2: $n['ClassID'] = 'SC_MENU_NEWS'; break;
			case 3: $n['ClassID'] = 'SC_MENU_FEEDBACK'; break;
			case 4: $n['ClassID'] = 'SC_MENU_GUESTBOOK'; break;
			case 5: $n['ClassID'] = 'SC_MENU_PAGE_'.$n['sNCid']; break;
			case 6: $n['ClassID'] = 'SC_MENU_DOWNLOAD'; break;
			case 7: $n['ClassID'] = 'SC_MENU_Y_'.$n['sSort']; break;
		}
		$NewNavigation[] = $n;
	}
}
@array_multisort($vSort,SORT_ASC,$vModu,SORT_ASC,$NewNavigation); 
$SC -> assign('navis',$NewNavigation);
$CONFIG_NAVIGATION = explode(',',${'CONFIG_NAVIGATION'.$Lang});
$menu['open'] = $CONFIG_NAVIGATION[0]; 
if($CONFIG_NAVIGATION[0] == 1){
	$CidArray = explode('|',$CONFIG_NAVIGATION[4]);
	foreach($CidArray as $i => $n){
		$SQL = "SELECT count(`ID`) FROM `{$dbprefix}column` WHERE `ColumnLang` = {$Lang} && `ColumnLevel` > 1 && `ColumnRela` LIKE '%{$n}%'";
		$Result = $sdb -> SelectSQL($SQL,0);
		if($Result[0][0] == 0){ 
			$menu['title'][] = $n;
		} else {
			$menu['parts'][] = $n; 
		}
	}
	if(!is_array($menu['title'])) $menu['title'] = array();
	if(!is_array($menu['parts'])) $menu['parts'] = array();
}
$SC -> assign('menu',$menu);
if(!file_exists($TemDir . $TemFile)) die($Warning[0] . $TemDir . $TemFile); 
for($i=1;$i<=$WebLangKind && $WebLangKind>1;$i++){
	if($isDynamicURL == 0){ 
		$URL = $i != 1 ? './html/index' . $i . '.html' : './home.html';
	} else {
		$URL = './?l' . $i . '/';
	}
	$AllLang[] = array('Name' => $WebLangName[($i-1)],'URL' => $URL); 
}
$SC -> assign('AllLang',$AllLang);
unset($swfUrl,$swfWidth,$swfHeight,$swfColor,$vSort,$vModu);
$SC -> assign('TemFile',$TemFile);
?>